package com.huan.dao.mapper;

import com.huan.pojo.Student;
import org.apache.ibatis.annotations.*;
import java.util.List;

public interface StudentMapper {
    /**
     * 查询总记录数
     * @return
     */
    @Select("select count(*) from 学生情况")
    int selectTotalCount();


    /**
     * 分页条件查询
     * @param begin
     * @param size
     * @return
     */
    List<Student> selectByPageAndCondition(@Param("begin") int begin, @Param("size") int size, @Param("student") Student student);

    /**
     * 根据条件查询总记录数
     * @return
     */
    int selectTotalCountByCondition(Student student);

    /**
     * 增加学生
     * @param student
     */
    @Insert("insert into 学生情况 values(#{studentID},#{name},#{sex}," +
            "#{birthday},#{originPlace},#{departmentID},#{political},#{accommodation}" +
            ",#{phone},null)")
    boolean add(Student student);

    /**
     * 编辑学生
     * @param student
     */
    @Update("update 学生情况 set studentID = #{studentID},name = #{name},sex = #{sex},birthday = #{birthday} " +
            ",originPlace = #{originPlace},accommodation = #{accommodation},phone = #{phone} where studentID = #{studentID}")
    int update(Student student);

    /**
     *删除
     * @param studentID
     */
    @Delete("delete from 学生情况 where studentID = #{studentID}")
    void delete(String studentID);

    /**
     * 批量删除学生
     * @param ids
     */
    void deleteByIds(@Param("ids") String[] ids);

    /**
     * 学生情况打印
     * @return
     */
    @Select("select * from 学生情况")
    List<Student> printStudent();



}
